import { Module } from '@nestjs/common'
import { CdnController } from './controllers/cdn.controller'
import { CdnCordModule } from '@boticord/cdncord'
import { ConfigModule, ConfigService } from '@nestjs/config'
import { StartupModule } from '@boticord/startup'
import { authProvider } from '@boticord/auth'

@Module({
  imports: [
    StartupModule.forRoot('CdnService'),
    CdnCordModule.registerAsync({
      inject: [ ConfigService ],
      imports: [ ConfigModule ],
      useFactory: (config: ConfigService) => ({
        webhookID: config.getOrThrow('DISCORD_WEBHOOK_CDN_ID'),
        webhookToken: config.getOrThrow('DISCORD_WEBHOOK_CDN_TOKEN'),
      }), 
    }),
  ],
  controllers: [ CdnController ],
  providers: [ authProvider ],
})
export class AppModule {}
